home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / windows5 / xwinc100.zip / CONTRIB-.00 / CONTRIB- / contrib / examples / Xaw / xhw.c < prev    next >
C/C++ Source or Header  |  1991-01-22  |  3KB  |  84 lines

  1. /*
  2.  * This an example of how "Hello, World" could be written using
  3.  * The X Toolkit and the Athena widget set.
  4.  *
  5.  * November 14, 1989 - Chris D. Peterson 
  6.  */
  7.  
  8. /*
  9.  * $XConsortium: xhw.c,v 1.9 91/01/22 19:24:48 gildea Exp $
  10.  *
  11.  * Copyright 1989 Massachusetts Institute of Technology
  12.  *
  13.  * Permission to use, copy, modify, distribute, and sell this software and its
  14.  * documentation for any purpose is hereby granted without fee, provided that
  15.  * the above copyright notice appear in all copies and that both that
  16.  * copyright notice and this permission notice appear in supporting
  17.  * documentation, and that the name of M.I.T. not be used in advertising or
  18.  * publicity pertaining to distribution of the software without specific,
  19.  * written prior permission.  M.I.T. makes no representations about the
  20.  * suitability of this software for any purpose.  It is provided "as is"
  21.  * without express or implied warranty.
  22.  *
  23.  * M.I.T. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  24.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL M.I.T.
  25.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  26.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  27.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  28.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  29.  */
  30.  
  31. #include <stdio.h>
  32.  
  33. #include <X11/Intrinsic.h>    /* Include standard Toolkit Header file.
  34.                    We do no need "StringDefs.h" */
  35.  
  36. #include <X11/Xaw/Label.h>    /* Include the Label widget's header file. */
  37. #include <X11/Xaw/Cardinals.h>    /* Definition of ZERO. */
  38.  
  39. /*
  40.  * These resources will only get loaded if there is no app-defaults
  41.  * file for this application.  Since this is such a simple application
  42.  * I am just loading the resources here.  For more complex applications
  43.  * It is best to install an app-defaults file.
  44.  */
  45.  
  46. String fallback_resources[] = { "*Label.Label:    Hello, World", NULL };
  47.  
  48. main(argc, argv)
  49. int argc;
  50. char **argv;
  51. {
  52.     XtAppContext app_con;
  53.     Widget toplevel;
  54.  
  55.     /*
  56.      * Initialize the Toolkit, set the fallback resources, and get
  57.      * the application context associated with this application.
  58.      */
  59.  
  60.     toplevel = XtAppInitialize(&app_con, "Xhw", NULL, ZERO, &argc, argv,
  61.                    fallback_resources, NULL, ZERO);
  62.  
  63.     /*
  64.      * Create a Widget to display the string.  The label is picked up
  65.      * from the resource database.
  66.      */
  67.  
  68.     (void) XtCreateManagedWidget("label", labelWidgetClass, toplevel, 
  69.                  NULL, ZERO);
  70.  
  71.     /*
  72.      * Create the windows, and set their attributes according
  73.      * to the Widget data.
  74.      */
  75.  
  76.     XtRealizeWidget(toplevel);
  77.  
  78.     /*
  79.      * Now process the events.
  80.      */
  81.     
  82.     XtAppMainLoop(app_con);
  83. }
  84.